<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Top Level Domain utils</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="libsoup Reference Manual">
<link rel="up" href="ch02.html" title="Core API">
<link rel="prev" href="libsoup-2.4-soup-status.html" title="soup-status">
<link rel="next" href="SoupURI.html" title="SoupURI">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="libsoup-2.4-soup-status.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">libsoup Reference Manual</th>
<td><a accesskey="n" href="SoupURI.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#libsoup-2.4-Top-Level-Domain-utils.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#libsoup-2.4-Top-Level-Domain-utils.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="libsoup-2.4-Top-Level-Domain-utils"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="libsoup-2.4-Top-Level-Domain-utils.top_of_page"></a>Top Level Domain utils</span></h2>
<p>Top Level Domain utils</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="libsoup-2.4-Top-Level-Domain-utils.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;libsoup/soup.h&gt;

const <span class="returnvalue">char</span> *        <a class="link" href="libsoup-2.4-Top-Level-Domain-utils.html#soup-tld-get-base-domain" title="soup_tld_get_base_domain ()">soup_tld_get_base_domain</a>            (<em class="parameter"><code>const <span class="type">char</span> *hostname</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="libsoup-2.4-Top-Level-Domain-utils.html#soup-tld-domain-is-public-suffix" title="soup_tld_domain_is_public_suffix ()">soup_tld_domain_is_public_suffix</a>    (<em class="parameter"><code>const <span class="type">char</span> *domain</code></em>);

#define             <a class="link" href="libsoup-2.4-Top-Level-Domain-utils.html#SOUP-TLD-ERROR:CAPS" title="SOUP_TLD_ERROR">SOUP_TLD_ERROR</a>
enum                <a class="link" href="libsoup-2.4-Top-Level-Domain-utils.html#SoupTLDError" title="enum SoupTLDError">SoupTLDError</a>;
</pre>
</div>
<div class="refsect1">
<a name="libsoup-2.4-Top-Level-Domain-utils.description"></a><h2>Description</h2>
<p>
</p>
</div>
<div class="refsect1">
<a name="libsoup-2.4-Top-Level-Domain-utils.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="soup-tld-get-base-domain"></a><h3>soup_tld_get_base_domain ()</h3>
<pre class="programlisting">const <span class="returnvalue">char</span> *        soup_tld_get_base_domain            (<em class="parameter"><code>const <span class="type">char</span> *hostname</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Finds the base domain for a given <em class="parameter"><code>hostname</code></em>. The base domain is
composed by the top level domain (such as .org, .com, .co.uk, etc)
plus the second level domain, for example for myhost.mydomain.com
it will return mydomain.com.
</p>
<p>
This method only works for valid UTF-8 hostnames in their canonical
representation form, so you should use <a href="http://library.gnome.org/devel/glib/unstable/glib-Hostname-Utilities.html#g-hostname-to-unicode"><code class="function">g_hostname_to_unicode()</code></a> to
get the canonical representation if that is not the case.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>hostname</code></em> :</span></p></td>
<td>a UTF-8 hostname in its canonical representation form</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>return location for a <a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore
errors. See <a class="link" href="libsoup-2.4-Top-Level-Domain-utils.html#SoupTLDError" title="enum SoupTLDError"><span class="type">SoupTLDError</span></a> for the available error codes</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a pointer to the start of the base domain in <em class="parameter"><code>hostname</code></em>. If
an error occurs, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> will be returned and <em class="parameter"><code>error</code></em> set.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.40</p>
</div>
<hr>
<div class="refsect2">
<a name="soup-tld-domain-is-public-suffix"></a><h3>soup_tld_domain_is_public_suffix ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            soup_tld_domain_is_public_suffix    (<em class="parameter"><code>const <span class="type">char</span> *domain</code></em>);</pre>
<p>
Looks whether the <em class="parameter"><code>domain</code></em> passed as argument is a public domain
suffix (.org, .com, .co.uk, etc) or not.
</p>
<p>
This method only works for valid UTF-8 domains in their canonical
representation form, so you should use <a href="http://library.gnome.org/devel/glib/unstable/glib-Hostname-Utilities.html#g-hostname-to-unicode"><code class="function">g_hostname_to_unicode()</code></a> to
get the canonical representation if that is not the case.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>domain</code></em> :</span></p></td>
<td>a UTF-8 domain in its canonical representation form</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if it is a public domain, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.40</p>
</div>
<hr>
<div class="refsect2">
<a name="SOUP-TLD-ERROR:CAPS"></a><h3>SOUP_TLD_ERROR</h3>
<pre class="programlisting">#define SOUP_TLD_ERROR soup_tld_error_quark()
</pre>
<p>
</p>
</div>
<hr>
<div class="refsect2">
<a name="SoupTLDError"></a><h3>enum SoupTLDError</h3>
<pre class="programlisting">typedef enum {
	SOUP_TLD_ERROR_INVALID_HOSTNAME,
	SOUP_TLD_ERROR_IS_IP_ADDRESS,
	SOUP_TLD_ERROR_NOT_ENOUGH_DOMAINS
} SoupTLDError;
</pre>
<p>
</p>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.18</div>
</body>
</html>